-
Notifications
You must be signed in to change notification settings - Fork 3
chore: update readmes, fix types and comments #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 5a9ea40 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughPatch-version changeset plus multiple documentation, README/type import cleanups, a storage API docs surface change, an iframe redirect error-handling behavior change (resolve vs reject), and an enabled e2e FIDO test. No runtime API signature changes in source code were introduced. Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit 5a9ea40
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
packages/device-client/src/lib/device.store.ts (2)
339-344:⚠️ Potential issue | 🟡 MinorJSDoc description inconsistency: "Get profile devices" should be "Delete profile device".
The
@function deleteannotation is correct, but the description on line 340 still says "Get profile devices" which doesn't match the delete operation. Similarly, the@paramdescription on line 344 says "used to update a profile device" but should say "used to delete a profile device".📝 Proposed fix for JSDoc description
/** - * Get profile devices + * Delete a profile device * * `@async` * `@function` delete - * `@param` {ProfileDevicesQuery} query - The query used to update a profile device + * `@param` {ProfileDevicesQuery} query - The query used to delete a profile device * `@returns` {Promise<null | { error: unknown }>} - A promise that resolves to null or an error object if the response is not valid. */
316-321:⚠️ Potential issue | 🟡 MinorJSDoc description inconsistency: "Get profile devices" should describe the update operation.
The description on line 317 says "Get profile devices" but this is the
updatefunction. The description should reflect the update operation.📝 Proposed fix for JSDoc description
/** - * Get profile devices + * Update a profile device * * `@async` * `@function` update * `@param` {ProfileDevicesQuery} query - The query used to update a profile device
🤖 Fix all issues with AI agents
In `@packages/protect/README.md`:
- Around line 73-77: The README code sample has a typo: the client variable is
spelled "jouneyClient" instead of "journeyClient", which would break copy‑paste;
update the snippet to use the correct symbol "journeyClient.next(step)" so it
matches the rest of the docs and any referenced initialization code.
In `@packages/sdk-effects/iframe-manager/src/lib/iframe-manager.effects.ts`:
- Around line 116-120: Update the JSDoc for the method that uses hasErrorParams
to indicate that when errorParams are present the function now resolves (not
rejects) with parsedParams for context; locate the docstring above the function
containing hasErrorParams/searchParams/errorParams and change wording from
"rejects on error" to something like "resolves with parsed params when
errorParams are present" and mention cleanup() is called before resolve to
preserve expected behavior.
In `@packages/sdk-effects/storage/README.md`:
- Around line 44-54: The README example uses the type GenericError in the
CustomStorageObject method signatures but doesn't show where it comes from;
update the example to import or document GenericError (e.g., reference
GenericError alongside CustomStorageObject/CustomStorageConfig) so readers can
resolve the type. Specifically, add or mention an import that includes
GenericError (the same module that exports
CustomStorageObject/CustomStorageConfig, or note it comes from
`@forgerock/sdk-types`) and ensure the README example references those symbols
(GenericError, CustomStorageObject, CustomStorageConfig) so the example compiles
for consumers.
In `@packages/sdk-types/README.md`:
- Around line 125-135: Update the README's build and test commands to reference
the correct Nx project name: replace occurrences of "nx build storage" and "nx
test storage" with "nx build sdk-types" and "nx test sdk-types" respectively so
the commands match the actual package; ensure the changes are made in
packages/sdk-types/README.md where the "Building" and "Testing" sections define
those commands.
In `@packages/sdk-utilities/README.md`:
- Around line 84-90: The README’s test command misspells the Nx project target;
update the command string in packages/sdk-utilities/README.md from "nx test
sdk-utiities" to the correct project name "nx test sdk-utilities" so the Nx test
target (sdk-utilities) will run correctly.
🧹 Nitpick comments (2)
packages/davinci-client/src/lib/fido/README.md (1)
7-8: Good addition—browser support note is helpful.The note clearly states the browser requirement for WebAuthn APIs, which is important context for developers.
Optional enhancement: Consider adding browser compatibility details.
To make this more actionable for developers, you could optionally enhance the note with:
- A link to browser compatibility information (e.g., MDN or caniuse.com)
- Mention of how to detect/handle unsupported browsers
- Minimum browser versions if applicable
Example:
-**Note**: To use this module, browser support is required for `navigator.credentials.create` and `navigator.credentials.get` +**Note**: To use this module, browser support is required for [`navigator.credentials.create`](https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/create) and [`navigator.credentials.get`](https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/get). Check browser compatibility and consider feature detection before using this module.packages/sdk-effects/iframe-manager/README.md (1)
89-103: Catch block example may be misleading given the new resolve behavior.Since
errorParamsnow causes the promise to resolve (not reject), the catch block at lines 89-103 will only handle truly unexpected errors orinternal_errorcases. The check forerrorResult.error || errorResult.error_descriptionat lines 94-98 within the catch block appears redundant with the new behavior, as server errors viaerrorParamsshould now be handled in the success path (lines 79-82).Consider simplifying the catch block to only handle internal errors:
📝 Suggested simplification
} catch (errorResult) { - // Failure case: Check if it's a known error from the server or an internal error if (errorResult && errorResult.type === 'internal_error') { // Timeout or iframe access error console.error(`Iframe operation failed: ${errorResult.message}`); - } else if (errorResult && (errorResult.error || errorResult.error_description)) { - // Error reported by the authorization server via errorParams - console.error('Silent login failed. Server returned error:', errorResult); - // const errorCode = errorResult.error; - // const errorDesc = errorResult.error_description; } else { // Other unexpected error console.error('An unexpected error occurred:', errorResult); } }
| const myCustomStore: CustomStorageObject = { | ||
| get: async (key: string): Promise<string | null | GenericError> => { | ||
| /* ... custom logic ... */ | ||
| }, | ||
| set: async (key, value) => { | ||
| set: async (key: string, valueToSet: string): Promise<void | GenericError> => { | ||
| /* ... custom logic ... */ | ||
| }, | ||
| remove: async (key) => { | ||
| remove: async (key: string): Promise<void | GenericError> => { | ||
| /* ... custom logic ... */ | ||
| }, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing GenericError type reference in custom storage example.
The custom storage methods reference GenericError in their return types (e.g., Promise<string | null | GenericError>) but there's no import or explanation of where this type comes from.
📝 Suggested addition to imports or explanation
Either add to the import:
import { createStorage, type CustomStorageConfig, type CustomStorageObject, type GenericError } from '@forgerock/storage';Or add a note explaining that GenericError is imported from @forgerock/sdk-types.
🤖 Prompt for AI Agents
In `@packages/sdk-effects/storage/README.md` around lines 44 - 54, The README
example uses the type GenericError in the CustomStorageObject method signatures
but doesn't show where it comes from; update the example to import or document
GenericError (e.g., reference GenericError alongside
CustomStorageObject/CustomStorageConfig) so readers can resolve the type.
Specifically, add or mention an import that includes GenericError (the same
module that exports CustomStorageObject/CustomStorageConfig, or note it comes
from `@forgerock/sdk-types`) and ensure the README example references those
symbols (GenericError, CustomStorageObject, CustomStorageConfig) so the example
compiles for consumers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nx Cloud has identified a flaky task in your failed CI:
🔂 Since the failure was identified as flaky, we triggered a CI rerun by adding an empty commit to this branch.
🎓 Learn more about Self-Healing CI on nx.dev
aa00986 to
7042fda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
packages/device-client/src/lib/device.store.ts (1)
339-344:⚠️ Potential issue | 🟡 MinorRemaining copy-paste JSDoc issues in the
profilesection.The
@functiontag fix on line 343 is correct, but the surrounding JSDoc still has leftover issues from copy-paste:
- Line 340: Description says "Get profile devices" — should be "Delete a profile device" (same issue on line 317 for
update, which says "Get profile devices" instead of "Update a profile device").- Line 344:
@paramsays "The query used to update a profile device" — should say "delete".- Line 322 (the
updatemethod's@returns): Minor typo — "or or an error object" has a duplicated "or".Since this PR targets comment fixes, consider cleaning these up as well.
📝 Proposed JSDoc fixes for the profile section
For the
updatemethod (lines 316–322):/** - * Get profile devices + * Update a profile device * * `@async` * `@function` update * `@param` {ProfileDevicesQuery} query - The query used to update a profile device - * `@returns` {Promise<ProfileDevice | { error: unknown }>} - A promise that resolves to the response data or or an error object if the response is not valid. + * `@returns` {Promise<ProfileDevice | { error: unknown }>} - A promise that resolves to the response data or an error object if the response is not valid. */For the
deletemethod (lines 339–344):/** - * Get profile devices + * Delete a profile device * * `@async` * `@function` delete - * `@param` {ProfileDevicesQuery} query - The query used to update a profile device + * `@param` {ProfileDevicesQuery} query - The query used to delete a profile device * `@returns` {Promise<null | { error: unknown }>} - A promise that resolves to null or an error object if the response is not valid. */packages/sdk-effects/logger/README.md (1)
78-110:⚠️ Potential issue | 🟡 MinorClarify that level filtering applies before delegating to custom logger.
The current text "all log calls will be delegated" is misleading—the implementation applies level filtering before delegation, so calls below the current level never reach the custom logger. Update to:
Suggested fix
-When a custom logger is provided, all log calls will be delegated to your implementation. If no custom logger is provided, the logger falls back to the browser's native `console` methods. +When a custom logger is provided, log calls are first filtered by the current level, then delegated to your implementation. If no custom logger is provided, the logger falls back to the browser's native `console` methods.packages/sdk-effects/iframe-manager/README.md (2)
49-54:⚠️ Potential issue | 🔴 CriticalCritical: Inconsistent error handling documentation.
Lines 49-53 state that failures resolve with error objects, but line 54 says it returns "An
Error" for validation failures (missing/emptysuccessParamsorerrorParams). This is ambiguous:
- Does line 54 mean the promise rejects with an Error (throwing synchronously or rejecting the promise)?
- Or does it mean the promise resolves with an Error object?
This inconsistency will confuse developers about whether they need a
try-catchblock for validation errors.Recommendation: Clarify whether validation errors reject the promise or resolve with an error object. If they reject, update the "On Failure" heading to distinguish between resolution-based errors and rejection-based errors.
89-103:⚠️ Potential issue | 🟠 MajorMajor: Catch block appears inconsistent with documented behavior.
The documentation states (lines 49-53) that internal errors resolve with objects like
{ type: 'internal_error', message: '...' }. However, the example's catch block (lines 89-103) attempts to handle these internal_error objects, which would never execute if they resolve rather than reject.Additionally:
- Lines 94-98 check for
error/error_descriptionin the catch block, but these are already handled at lines 79-82 in the try block.- If the promise always resolves (as stated in line 75), this entire catch block would only execute for the validation Error mentioned in line 54.
Recommendation: Clarify the catch block's purpose:
- If internal_error cases truly resolve (per docs), remove lines 91-93 from the catch block
- If error parameters truly resolve (per docs), remove lines 94-98 from the catch block
- Keep the catch block only if line 54 validation errors actually reject (and document this clearly)
🧹 Nitpick comments (2)
packages/sdk-effects/storage/README.md (1)
70-70: Minor style improvement: incomplete sentence.The sentence lacks a subject. Consider revising for better readability.
✍️ Suggested style fix
-- `type`: Specifies the storage mechanism. Can be `'localStorage'`, `'sessionStorage'`, or `'custom'`. +- `type`: Specifies the storage mechanism. It can be `'localStorage'`, `'sessionStorage'`, or `'custom'`.packages/device-client/README.md (1)
233-236: Simplify the error checking logic.The condition
!Array.isArray(getResponse) || 'error' in getResponseis unnecessarily complex. Given the return typeWebAuthnDevice[] | { error: unknown }, the|| 'error' in getResponsepart is redundant since arrays won't have an 'error' property. A cleaner and more idiomatic approach would be to use just the type guard'error' in getResponse, which TypeScript will properly narrow.📝 Suggested simplification
const getResponse = await apiClient.webAuthn.get(query); -if (!Array.isArray(getResponse) || 'error' in getResponse) { +if ('error' in getResponse) { // handle get device error }
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (40.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #526 +/- ##
==========================================
+ Coverage 18.79% 18.82% +0.03%
==========================================
Files 140 142 +2
Lines 27640 27730 +90
Branches 980 991 +11
==========================================
+ Hits 5195 5221 +26
- Misses 22445 22509 +64
🚀 New features to boost your workflow:
|
@forgerock/davinci-client
@forgerock/device-client
@forgerock/journey-client
@forgerock/oidc-client
@forgerock/protect
@forgerock/sdk-types
@forgerock/sdk-utilities
@forgerock/iframe-manager
@forgerock/sdk-logger
@forgerock/sdk-oidc
@forgerock/sdk-request-middleware
@forgerock/storage
commit: |
|
Deployed a26239e to https://ForgeRock.github.io/ping-javascript-sdk/pr-526/a26239ed414a37a87e64d87de41025a641a5a474 branch gh-pages in ForgeRock/ping-javascript-sdk |
📦 Bundle Size Analysis📦 Bundle Size Analysis🚨 Significant Changes🔻 @forgerock/journey-client - 0.0 KB (-82.5 KB, -100.0%) 📊 Minor Changes📈 @forgerock/device-client - 9.3 KB (+0.0 KB) ➖ No Changes➖ @forgerock/oidc-client - 23.5 KB 13 packages analyzed • Baseline from latest Legend🆕 New package ℹ️ How bundle sizes are calculated
🔄 Updated automatically on each push to this PR |
cerebrl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just left a single comment.
7042fda to
f173256
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
packages/device-client/src/lib/device.store.ts (1)
316-345:⚠️ Potential issue | 🟡 MinorJSDoc descriptions for
profile.updateandprofile.deletestill say "Get profile devices".Lines 317 and 340 both read
Get profile devices, but they document theupdateanddeletemethods respectively. The@functiontags were correctly updated, but the summary lines were missed.📝 Proposed fix
/** - * Get profile devices + * Update a profile device * * `@async` * `@function` update/** - * Get profile devices + * Delete a profile device * * `@async` * `@function` deletepackages/sdk-effects/iframe-manager/README.md (2)
49-54:⚠️ Potential issue | 🟡 MinorAPI reference incorrectly states internal errors "resolve" — they actually reject.
Lines 51–53 describe timeout, cross-origin, and setup failures as resolving, but the implementation uses
reject()for all three (lines 141, 156, and 165 iniframe-manager.effects.ts). Only the error-params case (line 50) truly resolves.Suggested fix: split the section into "Resolves" (error params) and "Rejects" (internal errors).
Proposed doc fix
- **On Failure**: Resolves with: - - `ResolvedParams`: An object containing _all_ parsed query parameters if the final redirect URL contains any key listed in `errorParams`. - - An object `{ type: 'internal_error', message: 'iframe timed out' }` if the specified `timeout` is reached before a success or error condition is met. - - An object `{ type: 'internal_error', message: 'unexpected failure' }` if there's an error accessing the iframe's content window (most likely due to a cross-origin redirect that wasn't expected or handled). - - An object `{ type: 'internal_error', message: 'error setting up iframe' }` if there was an issue creating or configuring the iframe initially. - - An `Error` if `successParams` or `errorParams` are missing or empty during setup. + **On Error Params**: Resolves with `ResolvedParams` containing _all_ parsed query parameters if the final redirect URL contains any key listed in `errorParams`. The caller must inspect the result for error keys. + **On Failure (Rejects)**: Rejects with: + - `{ type: 'internal_error', message: 'iframe timed out' }` if the specified `timeout` is reached. + - `{ type: 'internal_error', message: 'unexpected failure' }` on cross-origin access errors. + - `{ type: 'internal_error', message: 'error setting up iframe' }` on iframe creation failure. + - Throws an `Error` synchronously if `successParams` or `errorParams` are missing or empty.
89-102:⚠️ Potential issue | 🟡 MinorCatch block in example contains dead code for the new error-params flow.
Lines 94–98 check for
errorResult.error/errorResult.error_descriptioninside thecatchblock, but with the new behavior, error params now resolve (handled on lines 79–82 in thetryblock). This branch is unreachable and will confuse readers about the new contract.Suggested cleanup
} catch (errorResult) { - // Failure case: Check if it's a known error from the server or an internal error if (errorResult && errorResult.type === 'internal_error') { // Timeout or iframe access error console.error(`Iframe operation failed: ${errorResult.message}`); - } else if (errorResult && (errorResult.error || errorResult.error_description)) { - // Error reported by the authorization server via errorParams - console.error('Silent login failed. Server returned error:', errorResult); - // const errorCode = errorResult.error; - // const errorDesc = errorResult.error_description; } else { // Other unexpected error console.error('An unexpected error occurred:', errorResult); } }
f173256 to
5a9ea40
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
packages/sdk-effects/sdk-request-middleware/README.md (1)
70-75:⚠️ Potential issue | 🟡 MinorFix switch-case syntax in snippet.
case 'DAVINCI_NEXT'is missing a colon, which makes the example invalid for copy/paste.🛠️ Proposed fix
- case 'DAVINCI_NEXT' + case 'DAVINCI_NEXT':packages/sdk-effects/iframe-manager/README.md (1)
89-103:⚠️ Potential issue | 🟡 MinorStale error-handling branch in the catch block of the usage example.
Lines 94-98 check for
errorResult.error/errorResult.error_descriptionin thecatchblock, but with the new resolve-on-error-params behavior, server-reported errors will never reachcatch— they'll be handled by the success path at lines 79-82. This dead branch in the example will confuse consumers trying to adopt the new API.Suggested cleanup
} catch (errorResult) { - // Failure case: Check if it's a known error from the server or an internal error if (errorResult && errorResult.type === 'internal_error') { // Timeout or iframe access error console.error(`Iframe operation failed: ${errorResult.message}`); - } else if (errorResult && (errorResult.error || errorResult.error_description)) { - // Error reported by the authorization server via errorParams - console.error('Silent login failed. Server returned error:', errorResult); - // const errorCode = errorResult.error; - // const errorDesc = errorResult.error_description; } else { // Other unexpected error console.error('An unexpected error occurred:', errorResult); } }
🤖 Fix all issues with AI agents
In `@packages/davinci-client/src/lib/fido/README.md`:
- Around line 7-8: Add a trailing period to the sentence that mentions browser
support for navigator.credentials.create and navigator.credentials.get (the
README line "**Note**: To use this module, browser support is required for
`navigator.credentials.create` and `navigator.credentials.get`") so the sentence
ends with a period.
In `@packages/sdk-effects/logger/README.md`:
- Around line 95-111: Update the README's documentation for the CustomLogger
interface to make cross-environment behavior explicit: replace the phrase "the
browser's native `console` methods" with "the native `console` methods (browser
or Node.js)" or similar, and ensure this note sits next to the `CustomLogger`
and `LogMessage` declarations; also update the `LogMessage` type suggestion in
the docs to recommend using `unknown` or `Record<string, unknown>` instead of
the broad `object` type so readers know to prefer safer types when implementing
`CustomLogger`.
- Around line 114-118: Update the README.md commands that currently say "Run `nx
build sdk-logger`" and "Run `nx test sdk-logger`" to match the repository
scripts: replace them with either the monorepo scripts "Run `pnpm nx nxBuild` to
build the library." and "Run `pnpm nx nxTest` to execute the unit tests via
Vitest." or use the pnpm filter syntax for the package `@forgerock/sdk-logger`:
"Run `pnpm --filter `@forgerock/sdk-logger` build`" and "Run `pnpm --filter
`@forgerock/sdk-logger` test`". Ensure both occurrences in README.md are updated
accordingly.
In `@packages/sdk-effects/sdk-request-middleware/README.md`:
- Around line 125-128: The docs for applyQuery are inconsistent: the text says
FetchArgs.url is a string but the example uses request.url as a URL object;
update the documentation and types to match the example by documenting that
FetchArgs.url may be a URL (or string) and adjust the callback signature
accordingly (e.g., `callback` receives modified `FetchArgs` where `url` is
`string | URL`), or alternatively change the example to treat request.url as a
string (e.g., use request.url.toString() or build a string URL) so both doc
comment and example agree; make sure to reference `applyQuery`, `callback`,
`FetchArgs`, and `request.url` when editing.
🧹 Nitpick comments (2)
packages/device-client/README.md (1)
234-234: Simplify error check for better TypeScript type narrowing.The condition
!Array.isArray(getResponse) || 'error' in getResponseis redundant. Using OR prevents TypeScript from properly narrowing the union type inside the if block. A single condition would be clearer and enable proper type inference.♻️ Recommended simplification
Choose one of these approaches for better type narrowing:
Option 1: Check for error property
-if (!Array.isArray(getResponse) || 'error' in getResponse) { +if ('error' in getResponse) { // handle get device error }Option 2: Check if not an array
-if (!Array.isArray(getResponse) || 'error' in getResponse) { +if (!Array.isArray(getResponse)) { // handle get device error }Both options allow TypeScript to correctly narrow the type inside and after the if block.
packages/sdk-effects/logger/README.md (1)
42-63: Consider enhancing the custom logger example.The placeholder comments
/* custom logging */are acceptable but could be more illustrative. Consider showing a concrete example that demonstrates actual logging behavior, such as forwarding to a third-party service or adding timestamps.📝 More illustrative example
import { logger } from '@forgerock/sdk-logger'; // Example: Custom logger that forwards to an external service const customLogger = { error: (...args) => { console.error(...args); externalService.logError(args); }, warn: (...args) => console.warn('[WARNING]', ...args), info: (...args) => console.info('[INFO]', ...args), debug: (...args) => console.debug('[DEBUG]', ...args), }; const log = logger({ level: 'info', custom: customLogger });
| **Note**: To use this module, browser support is required for `navigator.credentials.create` and `navigator.credentials.get` | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: missing period at end of sentence.
Proposed fix
-**Note**: To use this module, browser support is required for `navigator.credentials.create` and `navigator.credentials.get`
+**Note**: To use this module, browser support is required for `navigator.credentials.create` and `navigator.credentials.get`.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| **Note**: To use this module, browser support is required for `navigator.credentials.create` and `navigator.credentials.get` | |
| **Note**: To use this module, browser support is required for `navigator.credentials.create` and `navigator.credentials.get`. | |
🤖 Prompt for AI Agents
In `@packages/davinci-client/src/lib/fido/README.md` around lines 7 - 8, Add a
trailing period to the sentence that mentions browser support for
navigator.credentials.create and navigator.credentials.get (the README line
"**Note**: To use this module, browser support is required for
`navigator.credentials.create` and `navigator.credentials.get`") so the sentence
ends with a period.
| ### `CustomLogger` Interface | ||
|
|
||
| Defines the interface for custom logger implementations: | ||
|
|
||
| ```typescript | ||
| interface CustomLogger { | ||
| error: (...args: LogMessage[]) => void; | ||
| warn: (...args: LogMessage[]) => void; | ||
| info: (...args: LogMessage[]) => void; | ||
| debug: (...args: LogMessage[]) => void; | ||
| } | ||
|
|
||
| type LogMessage = string | number | object; | ||
| ``` | ||
|
|
||
| When a custom logger is provided, all log calls will be delegated to your implementation. If no custom logger is provided, the logger falls back to the browser's native `console` methods. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
find packages/sdk-effects/logger/src -type f \( -name "*.ts" -o -name "*.tsx" \) | head -20Repository: ForgeRock/ping-javascript-sdk
Length of output: 311
🏁 Script executed:
rg -l "CustomLogger" packages/sdk-effects/logger/src --type ts --type tsxRepository: ForgeRock/ping-javascript-sdk
Length of output: 100
🏁 Script executed:
rg "interface CustomLogger|type LogMessage" packages/sdk-effects/logger/src -A 10 -B 2Repository: ForgeRock/ping-javascript-sdk
Length of output: 1175
🏁 Script executed:
cat packages/sdk-effects/logger/README.md | sed -n '95,111p'Repository: ForgeRock/ping-javascript-sdk
Length of output: 608
🏁 Script executed:
cat packages/sdk-effects/logger/src/lib/logger.effects.tsRepository: ForgeRock/ping-javascript-sdk
Length of output: 1901
🏁 Script executed:
rg "console\." packages/sdk-effects/logger/src -B 2 -A 2Repository: ForgeRock/ping-javascript-sdk
Length of output: 910
🏁 Script executed:
rg "window|browser|globalThis" packages/sdk-effects/logger/srcRepository: ForgeRock/ping-javascript-sdk
Length of output: 55
Update documentation to clarify cross-environment support.
The CustomLogger interface and LogMessage type accurately reflect the implementation. However, line 110 is misleading: it states "browser's native console methods," but the logger falls back to the native console in both browser and Node.js environments. The implementation uses standard console.error, console.warn, console.info, and console.debug—all of which are available in both environments.
Revise line 110 to clarify this: "the logger falls back to the native console methods" or "the browser or Node.js console methods."
Additionally, the LogMessage type uses object, which is a broad TypeScript type. Consider using unknown or Record<string, unknown> for better type safety.
🤖 Prompt for AI Agents
In `@packages/sdk-effects/logger/README.md` around lines 95 - 111, Update the
README's documentation for the CustomLogger interface to make cross-environment
behavior explicit: replace the phrase "the browser's native `console` methods"
with "the native `console` methods (browser or Node.js)" or similar, and ensure
this note sits next to the `CustomLogger` and `LogMessage` declarations; also
update the `LogMessage` type suggestion in the docs to recommend using `unknown`
or `Record<string, unknown>` instead of the broad `object` type so readers know
to prefer safer types when implementing `CustomLogger`.
| Run `nx build sdk-logger` to build the library. | ||
|
|
||
| ## Running unit tests | ||
|
|
||
| Run `nx test @forgerock/sdk-logger` to execute the unit tests via [Vitest](https://vitest.dev/). | ||
| Run `nx test sdk-logger` to execute the unit tests via [Vitest](https://vitest.dev/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check project.json in the logger directory
echo "=== Checking project.json ==="
if [ -f "packages/sdk-effects/logger/project.json" ]; then
cat packages/sdk-effects/logger/project.json
else
echo "project.json not found"
fi
echo -e "\n=== Checking nx.json ==="
if [ -f "nx.json" ]; then
cat nx.json | head -50
fi
echo -e "\n=== Listing packages/sdk-effects directory ==="
ls -la packages/sdk-effects/
echo -e "\n=== Checking for project definitions in root ==="
find . -maxdepth 2 -name "project.json" -o -name "workspace.json" 2>/dev/nullRepository: ForgeRock/ping-javascript-sdk
Length of output: 2155
🏁 Script executed:
#!/bin/bash
echo "=== Root project.json ==="
cat project.json 2>/dev/null || echo "No root project.json"
echo -e "\n=== Logger package.json ==="
if [ -f "packages/sdk-effects/logger/package.json" ]; then
cat packages/sdk-effects/logger/package.json
else
echo "package.json not found in logger directory"
fi
echo -e "\n=== Check if nx recognizes sdk-logger project ==="
# Try to list nx projects
nx show projects 2>/dev/null || echo "Could not list nx projects"Repository: ForgeRock/ping-javascript-sdk
Length of output: 1401
🏁 Script executed:
#!/bin/bash
echo "=== Check nx workspace layout ==="
# Try different approaches to list nx projects
if [ -f "package.json" ]; then
echo "Root package.json workspaces:"
cat package.json | grep -A 20 "workspaces"
fi
echo -e "\n=== Check for pnpm workspace ==="
if [ -f "pnpm-workspace.yaml" ]; then
cat pnpm-workspace.yaml
fi
echo -e "\n=== List all package.json files in packages ==="
find packages -name "package.json" -type f | head -20
echo -e "\n=== Check logger's actual nx targets ==="
cd packages/sdk-effects/logger && cat package.json | jq '.scripts'Repository: ForgeRock/ping-javascript-sdk
Length of output: 1475
🏁 Script executed:
#!/bin/bash
echo "=== Check another package for comparison ==="
if [ -f "packages/davinci-client/package.json" ]; then
echo "DaVinci client package.json scripts:"
cat packages/davinci-client/package.json | jq '.scripts'
fi
echo -e "\n=== Try to infer nx project names ==="
# Check if there's an nx.json that defines projects
if [ -f "nx.json" ]; then
echo "Checking nx.json for project configuration..."
cat nx.json | grep -A 10 "projects" || echo "No explicit projects defined in nx.json"
fi
echo -e "\n=== Check if nxBuild is a custom target ==="
# Search for nxBuild target definition
rg "nxBuild" --type json -A 3 -B 3 | head -50
echo -e "\n=== Try to run nx commands to see available projects ==="
cd packages/sdk-effects/logger && pnpm nx show project . --json 2>&1 | head -20Repository: ForgeRock/ping-javascript-sdk
Length of output: 5321
Update commands to match the actual package.json scripts.
The documented commands nx build sdk-logger and nx test sdk-logger don't match the scripts defined in package.json. All packages in this repository use pnpm nx nxBuild and pnpm nx nxTest without specifying a project name.
Update lines 114 and 118 to:
- Run
pnpm nx nxBuildto build the library. - Run
pnpm nx nxTestto execute the unit tests via Vitest.
Or alternatively, use the pnpm filter syntax:
- Run
pnpm --filter@forgerock/sdk-loggerbuildto build the library. - Run
pnpm --filter@forgerock/sdk-loggertestto execute the unit tests via Vitest.
🤖 Prompt for AI Agents
In `@packages/sdk-effects/logger/README.md` around lines 114 - 118, Update the
README.md commands that currently say "Run `nx build sdk-logger`" and "Run `nx
test sdk-logger`" to match the repository scripts: replace them with either the
monorepo scripts "Run `pnpm nx nxBuild` to build the library." and "Run `pnpm nx
nxTest` to execute the unit tests via Vitest." or use the pnpm filter syntax for
the package `@forgerock/sdk-logger`: "Run `pnpm --filter `@forgerock/sdk-logger`
build`" and "Run `pnpm --filter `@forgerock/sdk-logger` test`". Ensure both
occurrences in README.md are updated accordingly.
| - `callback`: An async function that takes the modified `FetchArgs` (with `url` as a string) and returns a Promise that resolves to a `QueryReturnValue` | ||
|
|
||
| **Returns:** | ||
| A Promise with the result of the callback function | ||
| A Promise that resolves to a `QueryReturnValue<unknown, FetchBaseQueryError, FetchBaseQueryMeta>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align applyQuery docs with the example’s request.url type.
The description says url is a string, but the example treats request.url as a URL object. Either update the doc to reflect a URL type or adjust the example to use a string to avoid confusion.
🤖 Prompt for AI Agents
In `@packages/sdk-effects/sdk-request-middleware/README.md` around lines 125 -
128, The docs for applyQuery are inconsistent: the text says FetchArgs.url is a
string but the example uses request.url as a URL object; update the
documentation and types to match the example by documenting that FetchArgs.url
may be a URL (or string) and adjust the callback signature accordingly (e.g.,
`callback` receives modified `FetchArgs` where `url` is `string | URL`), or
alternatively change the example to treat request.url as a string (e.g., use
request.url.toString() or build a string URL) so both doc comment and example
agree; make sure to reference `applyQuery`, `callback`, `FetchArgs`, and
`request.url` when editing.
JIRA Ticket
Description
Updates readmes for most packages except
sdk-oidcandjourney-clientSummary by CodeRabbit
Documentation
New Features / API
Behavior
Tests
Chores